<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: www
  Date: 2021/10/27
  Time: 10:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>会员信息</title>
    <link type="text/css" rel="stylesheet" href="fontsawesome/css/font-awesome.css"/>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div class="main_box">
    <h2><span></span>会员信息</h2>
    <div class="search_box clearfix">
        <form action="${pageContext.request.contextPath}/findOneMemberController" method="post">
            <label class="f_left">搜索会员：</label>
            <input type="text" name="parameter" id="parameter" placeholder="请输入手机号/车牌号/姓名" class="f_left search_input"/>
            <input type="submit" value="搜索" class="btn blue_btn search"/>
            <label class="f_left" style="color: red">${err}</label>
        </form>

    </div>
    <div class="cont_box">
        <ul class="tab_tit clearfix">
            <li>会员基本信息</li>
            <li>爱车</li>
            <li>储值卡</li>
            <li>年卡</li>
            <li>大礼包</li>
            <li>消费记录</li>
            <li>积分记录</li>
        </ul>
        <dl class="tab_conbox">
            <!--会员基本信息-->
            <dd>
                <form action="#" method="post" id="edit_user">
                    <div class="addpro_box clearfix">
                        <label></label>
                        <input type="hidden" value="${member.mid}" name="mid" />
                    </div>
                    <div class="addpro_box clearfix">
                        <label>姓名：</label>
                        <input type="text" value="${member.name}" name="name" required data-rule-fullname="true" data-msg-required="会员姓名不能为空"/>
                    </div>
                    <div class="addpro_box clearfix">
                        <label>手机号：</label>
                        <input type="text" value="${member.phone}" name="phone" required data-rule-mobile="true" data-msg-required="会员手机号不能为空"/>
                    </div>
                    <div class="addpro_box clearfix">
                        <label>所属门店：</label>
                        <input type="text" name="store" value="${member.store}" readonly/>
                    </div>
                    <div class="addpro_box learfix">
                        <label>注册来源：</label>
                        <input type="text" name="source" value="${member.source}" readonly/>
                    </div>
                    <div class="probtn_box clearfix">
                        <input type="button"  value="保存修改" class="btn blue_btn submit">
                    </div>
                </form>
            </dd>
            <!--爱车-->
            <dd>
                <c:if test="${member!=null}">
                <div class="margin_tb clearfix">
                    <button type="button"  class="btn blue_btn add_car" >添加爱车</button>
                </div>
                </c:if>
                <!--爱车信息-->
                <c:forEach items="${memberCars}" var="memberCars">
                <div class="ucar_list">
                    <h5>
                        <span>爱车编号:${memberCars.cid}</span>
                        <a href="${pageContext.request.contextPath}/toEdit_CarController?cid=${memberCars.cid}" class="edit_car">编辑车辆信息</a>
                        <a href="${pageContext.request.contextPath}/del_CarController?cid=${memberCars.cid}" class="del_car">删除车辆</a>
                    </h5>
                    <table border="0" cellspacing="0" cellpadding="0" class="table">
                        <tbody>
                        <tr>
                            <td>品牌</td>
                            <td>${memberCars.car_brand}</td>
                            <td>系列</td>
                            <td>${memberCars.car_series}</td>
                        </tr>
                        <tr>
                            <td>型号</td>
                            <td>${memberCars.car_brand}${memberCars.car_model}</td>
                            <td>发动机号</td>
                            <td>${memberCars.car_engine}</td>
                        </tr>
                        <tr>
                            <td>车牌号</td>
                            <td>${memberCars.c_number}</td>
                            <td>行程里数</td>
                            <td>${memberCars.car_travel}公里</td>
                        </tr>
                        <tr>
                            <td>行驶证</td>
                            <td>${memberCars.car_driving}</td>
                            <td>年份</td>
                            <td><fmt:formatDate value="${memberCars.car_year}"></fmt:formatDate></td>
                        </tr>
                        <tr>
                            <td>指导价</td>
                            <td>${memberCars.car_price}</td>
                            <td>保险到期日</td>
                            <td><fmt:formatDate value="${memberCars.car_expire}"></fmt:formatDate></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                </c:forEach>
            </dd>
            <!--储值卡-->
            <dd>
                <!--当前储值卡为空时显示添加按钮-->
                <c:if test="${member!=null}">
                <div class="margin_tb clearfix">
                    <button type="button" class="btn blue_btn add_pcard">添加储值卡</button>
                </div>
                </c:if>
                <table border="0" cellspacing="0" cellpadding="0" class="table">
                    <thead>
                    <tr>
                        <th>用户手机号</th>
                        <th>卡片ID</th>
                        <th>卡片种类</th>
                        <th>卡片余额</th>
                        <th>卡片折扣</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${memberCards}" var="memberCards">
                        <c:if test="${memberCards.clamp.equals('储值卡')}">
                    <tr id="${memberCards.oId}"><!--这里id为卡片操作时需要-->
                        <td>${memberCards.phone}</td>
                        <td>${memberCards.card}</td>
                        <td>${memberCards.clamps}</td>
                        <td>${memberCards.number}</td>
                        <td>${memberCards.discount}</td>
                        <td>
                            <a href="javascript:void(0);" class="table_btn table_edit upgrade_btn">
                                <i class="fa fa-thumbs-up"></i>
                                <span>卡片升级</span>
                            </a>
                            <a href="javascript:void(0);" class="table_btn table_info recharge_btn">
                                <i class="fa fa-mail-forward"></i>
                                <span>卡片充值</span>
                            </a>
                            <a href="${pageContext.request.contextPath}/pcard_deleteController?id=${memberCards.oId}" class="table_btn table_del del_btn">
                                <i class="fa fa-trash-o"></i>
                                <span>删除卡片</span>
                            </a>
                        </td>
                    </tr>
                        </c:if>
                    </c:forEach>
                    </tbody>
                </table>
            </dd>
            <!--年卡-->
            <dd>
                <!--当前年为空时显示添加按钮-->
                <c:if test="${member!=null}">
                <div class="margin_tb clearfix">
                    <button type="button" class="btn blue_btn add_ycard">添加年卡</button>
                </div>
                </c:if>
                <table border="0" cellspacing="0" cellpadding="0" class="table">
                    <thead>
                    <tr>
                        <th>用户手机号</th>
                        <th>用户姓名</th>
                        <th>卡片额度</th>
                        <th>绑定车牌号</th>
                        <th>办理日期</th>
                        <th>过期日期</th>
                        <th>状态</th>
                    </tr>
                    </thead>
                    <tbody>
                            <c:forEach items="${memberCards}" var="memberCards">
                    <tr>
                        <td>${memberCards.phone}</td>
                        <td>${memberCards.name}</td>
                        <td>${memberCards.number}</td>
                        <td>${memberCards.c_number}</td>
                        <td><fmt:formatDate value="${memberCards.cTime}"></fmt:formatDate></td>
                        <td><fmt:formatDate value="${memberCards.endTime}"></fmt:formatDate></td>
                        <td>${memberCards.state}</td>
                    </tr>
                            </c:forEach>
                    </tbody>
                </table>
            </dd>
            <!--大礼包-->
            <dd>
                <c:if test="${member!=null}">
                <div class="margin_tb clearfix">
                    <button type="button"  class="btn blue_btn add_spree">添加大礼包</button>
                </div>
                </c:if>
                <table border="0" cellspacing="0" cellpadding="0" class="table">
                    <thead>
                    <tr>
                        <th>用户手机号</th>
                        <th>大礼包</th>
                        <th>大礼包价格</th>
                        <th>办理日期</th>
                        <th>过期日期</th>
                        <th>大礼包详情</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${memberGifts}" var="memberGifts">
                    <tr>
                        <td>${memberGifts.phone}</td>
                        <td>${memberGifts.mname}</td>
                        <td>${memberGifts.price}</td>
                        <td><fmt:formatDate value="${memberGifts.tion_time}"></fmt:formatDate></td>
                        <td><fmt:formatDate value="${memberGifts.guotime}"></fmt:formatDate></td>
                        <td>${memberGifts.state}</td>
                    </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </dd>
            <!--消费记录-->
            <dd>
                <table border="0" cellspacing="0" cellpadding="0" class="table">
                    <thead>
                    <tr>
                        <th>订单号</th>
                        <th>消费金额</th>
                        <th>会员</th>
                        <th>手机号</th>
                        <th>支付</th>
                        <th>状态</th>
                        <th>开单日期</th>
                        <th>订单备注</th>
                        <th>所属门店</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${orders}" var="orders">
                    <tr>
                        <td>${orders.o_number}</td>
                        <td>${orders.money}</td>
                        <td>${member.name}</td>
                        <td>${member.phone}</td>
                        <td>${orders.mode}</td>
                        <td>${orders.state}</td>
                        <td>${orders.d_time}</td>
                        <td>${orders.remark}</td>
                        <td>${orders.o_name}</td>
                    </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </dd>
            <!--积分记录-->
            <dd>
                <table border="0" cellspacing="0" cellpadding="0" class="table">
                    <thead>
                    <tr>
                        <th>会员</th>
                        <th>手机号</th>
                        <th>原积分</th>
                        <th>状态</th>
                        <th>积分变动</th>
                        <th>当前积分</th>
                        <th>操作类型</th>
                        <th>操作日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${iintegrals}" var="iintegrals">
                    <tr>
                        <td>${iintegrals.name}</td>
                        <td>${iintegrals.phone}</td>
                        <td>${iintegrals.yjifen}</td>
                        <td>${iintegrals.status}</td>
                        <td>${iintegrals.bdfen}</td>
                        <td>${iintegrals.nowfen}</td>
                        <td>${iintegrals.type}</td>
                        <td><fmt:formatDate value="${iintegrals.time}"></fmt:formatDate></td>
                    </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </dd>
        </dl>
    </div>
</div>
<!--javascript include-->
<script src="js/jquery-2.2.1.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/other.js"></script>
<script>
    $(function(){
        $.jqtab(".tab_tit",".tab_conbox","click");
        var addCar = "${member.mid}",//添加爱车时所需id
            editCar = "",//添加爱车时所需id
            delCar = "",//添加爱车时所需id
            addYcard = "${member.mid}",//添加爱车时所需id
            addSpree = "${member.mid}",//添加爱车时所需id
            addPcard = "${member.mid}",//添加爱车时所需id
            delPcard = "";//添加爱车时所需id
        $("body").other({formId:"#edit_user",formUrl:"${pageContext.request.contextPath}/updateOneMemberController"});//formUrl 表单请求地址,linkHref 请求成功后跳转地址，此页面不需要，已删除
        $("body").tipWindow({method:"edit",type:"form",Class:".add_car",even:"click",dataId:addCar,tipTit:"添加爱车",Twidth:"700",Theight:"520",editUrl:"add_Car.jsp"});//editUrl 添加爱车请求地址
        // $("body").tipWindow({method:"edit",type:"form",Class:".edit_car",even:"click",dataId:editCar,tipTit:"编辑爱车",Twidth:"700",Theight:"520",editUrl:"edit_Car.jsp"});//editUrl 编辑爱车请求地址
        // $("body").tipWindow({method:"delete",Class:".del_car",even:"click",dataId:delCar,Twidth:"400",Theight:"180",delUrl:"#"});//delUrl 删除爱车请求地址
        $("body").tipWindow({method:"edit",type:"form",Class:".add_ycard",even:"click",dataId:addYcard,tipTit:"添加年卡",Twidth:"600",Theight:"400",editUrl:"${pageContext.request.contextPath}/toadd_YcardController"});//editUrl 添加年卡请求地址
        $("body").tipWindow({method:"edit",type:"form",Class:".add_spree",even:"click",dataId:addSpree,tipTit:"添加大礼包",Twidth:"600",Theight:"520",editUrl:"${pageContext.request.contextPath}/toadd_SpreeController"});//editUrl 添加大礼包请求地址
        $("body").tipWindow({method:"edit",type:"form",Class:".add_pcard",even:"click",dataId:addPcard,tipTit:"添加储值卡",Twidth:"600",Theight:"400",editUrl:"${pageContext.request.contextPath}/toadd_PcardController"});//editUrl 添加储值卡请求地址
        // $("body").tipWindow({method:"delete",Class:".del_btn",even:"click",Twidth:"400",dataId:delPcard,Theight:"180",delUrl:""});//delUrl 删除储值卡请求地址
        $("body").tipWindow({method:"edit",type:"form",Class:".upgrade_btn",even:"click",tipTit:"储值卡升级",Twidth:"600",Theight:"360",editUrl:"${pageContext.request.contextPath}/topcard_UpgradeController"});//editUrl 储值卡升级请求地址
        $("body").tipWindow({method:"edit",type:"form",Class:".recharge_btn",even:"click",tipTit:"储值卡充值",Twidth:"600",Theight:"300",editUrl:"${pageContext.request.contextPath}/topcard_RechargeController"});//editUrl 储值卡充值请求地址
        //查询会员获取信息
        // var userId = "";//会员id
        // var parameter=$('#parameter').value;
        // $(".search").click(function(){
        //     $.ajax({
        //         type:"post",
        //         url:"#",
        //         data:{"parameter":parameter},
        //         success:function(data){
        //
        //         },
        //         error:function(data){
        //             alert("查询失败，请重试！");
        //         }
        //     });
        // });

    });
</script>
</body>
</html>
